<template>
	<view>
		<u-tabs :list="list" 
			:is-scroll="false" 
			:current="current"
			@change="change"
			:active-color="appTheme.checkColor"
			/>
		<view v-show="current === 0">
			<clientele-info-view v-if="id" :clientelesId="id" :type="type" @success="success"></clientele-info-view>
		</view>
		<view v-show="current === 1">
			<clientele-dynamics-view v-if="id" :clientelesId="id" :type="type"></clientele-dynamics-view>
		</view>
	</view>
</template>

<script>
	import ClienteleDynamicsView from '@/pages_operate/clientele/clientele-dynamics-view.vue'
	import ClienteleInfoView from '@/pages_operate/clientele/clientele-info-view.vue'
	import appMixin from '@/mixins/app.js'
	export default {
		mixins: [appMixin],
		components: {
			ClienteleDynamicsView,
			ClienteleInfoView
		},
		data() {
			return {
				list: [{
					name: '基本信息'
				}, {
					name: '销售动态'
				}],
				current: 0,
				
				id: '',
				type: '0'
			}
		},
		onLoad(options) {
			console.log(options);
			this.type = options.type;
			this.id = options.leadsId;
		},
		methods: {
			change(index) {
				this.current = index;
			},
			
			success() {
				const eventChannel = this.getOpenerEventChannel();
				eventChannel.emit('addSuccess', {});
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="scss">
	page{
		height: 100%;
		background-color: $app-page-bg-color;
	}
</style>
